﻿using LimaLims.Core.Enum;
using LimaLims.Core;
using LimaLims.Application.Service.Base.Dto;
using Microsoft.EntityFrameworkCore;
using LimaLims.Core.Util;

namespace LimaLims.Application.Service.TestCenter.Dto
{
    /// <summary>
    /// 直阻试验
    /// </summary>
    public class DcResistanceOutput : BaseDto
    {
        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }
        /// <summary>
        /// 设备Id
        /// </summary>
        public long EquipmentInfoId { get; set; }
        /// <summary>
        /// 设备编号
        /// </summary>
        public string EquipmentCode { get; set; }

        /// <summary>
        /// 设备名称
        /// </summary>
        public string EquipmentName { get; set; }

        /// <summary>
        /// 试验任务ID
        /// </summary>
        public long? ExperimentTaskId { get; set; }

        /// <summary>
        /// 试验任务编号
        /// </summary>
        public string ExperimentTaskCode { get; set; }
        /// <summary>
        /// 环境温度
        /// </summary>
        public float? AmbientTemperature { get; set; }

        /// <summary>
        /// 环境湿度
        /// </summary>
        public float? AmbientHumidity { get; set; }

        /// <summary>
        /// 分接位置
        /// </summary>
        public int TappingGear { get; set; }

        /// <summary>
        /// 高压AB（Ω）
        /// </summary>
        public float? HighAB { get; set; }

        public float? HighBC { get; set; }

        public float? HighCA { get; set; }

        public float? HighUnbalanceRate { get; set; }

        /// <summary>
        /// 低压ab
        /// </summary>
        public float? Lowab { get; set; }

        public float? Lowbc { get; set; }

        public float? Lowca { get; set; }

        public float? LowUnbalanceRate { get; set; }

        /// <summary>
        /// 相电阻a0电阻值	
        /// </summary>
        public float? Lowa0 { get; set; }

        public float? Lowb0 { get; set; }

        public float? Lowc0 { get; set; }

        public float? Low0UnbalanceRate { get; set; }

        /// <summary>
        /// 高压侧相电阻A0电阻值	
        /// </summary>
        public float? HighA0 { get; set; }

        public float? HighB0 { get; set; }

        public float? HighC0 { get; set; }

        public float? High0UnbalanceRate { get; set; }

        /// <summary>
        /// 被试绕组	
        /// </summary>
        public WindingMethod WindingMethod { get; set; }

        /// <summary>
        /// 试验结果
        /// </summary>
        public ExperimentResult? Result { get; set; }
    }

    /// <summary>
    /// 直阻试验分页查询
    /// </summary>
    public class DcResistancePageInput : PageInputBase
    {
        /// <summary>
        /// 任务编号
        /// </summary>
        public string ExperimentTaskCode { get; set; }

        /// <summary>
        /// 设备编号
        /// </summary>
        public string EquipmentCode { get; set; }

        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }
    }


    /// <summary>
    /// 负载试验
    /// </summary>
    public class LoadTestOutput : BaseDto
    {
        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }
        /// <summary>
        /// 试验任务编号
        /// </summary>
        public string ExperimentTaskCode { get; set; }
        /// <summary>
        /// 设备编号
        /// </summary>
        public string EquipmentCode { get; set; }
        /// <summary>
        /// 设备名称
        /// </summary>
        public string EquipmentName { get; set; }

        /// <summary>
        /// 试验任务ID
        /// </summary>
        public long? ExperimentTaskId { get; set; }

        /// <summary>
        /// 设备Id
        /// </summary>
        public long EquipmentInfoId { get; set; }
        /// <summary>
        /// 环境温度
        /// </summary>
        public float? AmbientTemperature { get; set; }

        /// <summary>
        /// 环境湿度
        /// </summary>
        public float? AmbientHumidity { get; set; }

        /// <summary>
        /// 是否单相
        /// </summary>
        public bool IsSinglePhase { get; set; }

        /// <summary>
        /// 分接位置（电压位置：90、100、110）%
        /// </summary>
        public VoltageRatio TappingGear { get; set; }

        /// <summary>
        /// 有效值电压AB
        /// </summary>
        public float? UrmsAB { get; set; }
        public float? UrmsBC { get; set; }
        public float? UrmsCA { get; set; }
        /// <summary>
        /// 有效置电压平均值	
        /// </summary>
        public float? UrmsAverage { get; set; }

        /// <summary>
        /// 有效值电流AB
        /// </summary>
        public float? IrmsAB { get; set; }
        public float? IrmsBC { get; set; }
        public float? IrmsCA { get; set; }
        /// <summary>
        /// 有效值电流平均值	
        /// </summary>
        public float? IrmsAverage { get; set; }


        /// <summary>
        /// 有功功率AB
        /// </summary>
        public float? PAB { get; set; }
        public float? PBC { get; set; }
        public float? PCA { get; set; }

        /// <summary>
        /// 有功功率和	
        /// </summary>
        public float? SigmaP { get; set; }

        /// <summary>
        /// 频率	
        /// </summary>
        public float? Frequency { get; set; }
        /// <summary>
        /// 功率因数	
        /// </summary>
        public float? PowerFactor { get; set; }

        /// <summary>
        /// 负载损耗(KW)
        /// </summary>
        public float? Pk75 { get; set; }

        /// <summary>
        /// 阻抗电压(%)
        /// </summary>
        public float? Uk75 { get; set; }

        /// <summary>
        /// 短路阻抗(Q)
        /// </summary>
        public float? Zk75 { get; set; }

        /// <summary>
        /// 试验结果
        /// </summary>
        public ExperimentResult? Result { get; set; }

        /// <summary>
        /// 试验结果Text
        /// </summary>
        public string ResultText => Result.HasValue ? Result.GetDescription() : "";
    }


    /// <summary>
    /// 负载试验分页查询
    /// </summary>
    public class LoadTestPageInput : PageInputBase
    {
        /// <summary>
        /// 任务编号
        /// </summary>
        public string ExperimentTaskCode { get; set; }

        /// <summary>
        /// 设备编号
        /// </summary>
        public string EquipmentCode { get; set; }

        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }

    }

    /// <summary>
    /// 空载试验
    /// </summary>
    public class NoLoadTestOutput : BaseDto
    {
        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }
        /// <summary>
        /// 仪器设备Id
        /// </summary>
        public long EquipmentInfoId { get; set; }

        /// <summary>
        /// 仪器编号
        /// </summary>
        public string EquipmentCode { get; set; }

        /// <summary>
        /// 仪器名称
        /// </summary>
        public string EquipmentName { get; set; }

        /// <summary>
        /// 试验任务ID
        /// </summary>
        public long? ExperimentTaskId { get; set; }

        /// <summary>
        /// 试验任务编号
        /// </summary>
        public string ExperimentTaskCode { get; set; }

        /// <summary>
        /// 环境温度
        /// </summary>
        public float? AmbientTemperature { get; set; }

        /// <summary>
        /// 环境湿度
        /// </summary>
        public float? AmbientHumidity { get; set; }

        /// <summary>
        /// 有效值电压AB
        /// </summary>
        public float? UrmsAB { get; set; }
        public float? UrmsBC { get; set; }
        public float? UrmsCA { get; set; }
        /// <summary>
        /// 有效值电压平均值	
        /// </summary>
        public float? UrmsAverage { get; set; }

        /// <summary>
        /// 平均值电压AB
        /// </summary>
        public float? UrecAB { get; set; }
        public float? UrecBC { get; set; }
        public float? UrecCA { get; set; }
        /// <summary>
        /// 平均值电压平均值	
        /// </summary>
        public float? UrecAverage { get; set; }

        /// <summary>
        /// 有效值电流AB
        /// </summary>
        public float? IrmsAB { get; set; }
        public float? IrmsBC { get; set; }
        public float? IrmsCA { get; set; }
        /// <summary>
        /// 有效值电流平均值	
        /// </summary>
        public float? IrmsAverage { get; set; }

        /// <summary>
        /// 有功功率AB
        /// </summary>
        public float? PAB { get; set; }
        public float? PBC { get; set; }
        public float? PCA { get; set; }

        /// <summary>
        /// 有功功率和	
        /// </summary>
        public float? SigmaP { get; set; }

        /// <summary>
        /// 是否单相
        /// </summary>
        public bool IsSinglePhase { get; set; }

        /// <summary>
        /// 分接位置（电压位置：90、100、110）%
        /// </summary>
        public VoltageRatio TappingGear { get; set; }

        /// <summary>
        /// 频率	
        /// </summary>
        public float? Frequency { get; set; }
        /// <summary>
        /// 功率因数	
        /// </summary>
        public float? PowerFactor { get; set; }

        /// <summary>
        /// 波形因数	
        /// </summary>
        public float? KF { get; set; }

        ///// <summary>
        ///// 波峰因数	
        ///// </summary>
        //[Comment("波峰因数")]
        //public float? Kp { get; set; }

        /// <summary>
        /// 空载电流(%)	
        /// </summary>
        public float? I0 { get; set; }

        /// <summary>
        /// 空载损耗(KW)	
        /// </summary>
        public float? P0 { get; set; }

        /// <summary>
        /// 试验结果
        /// </summary>
        public ExperimentResult? Result { get; set; }

        /// <summary>
        /// 试验结果Text
        /// </summary>
        public string ResultText => Result.HasValue ? Result.GetDescription() : "";
    }

    /// <summary>
    /// 空载试验分页查询
    /// </summary>
    public class NoLoadTestPageInput : PageInputBase
    {
        /// <summary>
        /// 任务编号
        /// </summary>
        public string ExperimentTaskCode { get; set; }

        /// <summary>
        /// 设备编号
        /// </summary>
        public string EquipmentCode { get; set; }

        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }

    }

    /// <summary>
    /// 变比试验
    /// </summary>
    public class TransformationRatioOutput : BaseDto
    {
        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }
        /// <summary>
        /// 仪器设备Id
        /// </summary>
        public long EquipmentInfoId { get; set; }

        /// <summary>
        /// 仪器编号
        /// </summary>
        public string EquipmentCode { get; set; }

        /// <summary>
        /// 仪器名称
        /// </summary>
        public string EquipmentName { get; set; }

        /// <summary>
        /// 试验任务ID
        /// </summary>
        public long? ExperimentTaskId { get; set; }

        /// <summary>
        /// 试验任务编号
        /// </summary>
        public string ExperimentTaskCode { get; set; }

        /// <summary>
        /// 环境温度
        /// </summary>
        public float? AmbientTemperature { get; set; }

        /// <summary>
        /// 环境湿度
        /// </summary>
        public float? AmbientHumidity { get; set; }

        /// <summary>
        /// 分接位置
        /// </summary>
        public int TappingGear { get; set; }

        /// <summary>
        /// 联接组别号
        /// </summary>
        public string WiringMode { get; set; }

        /// <summary>
        /// 高压AB
        /// </summary>
        public float? HighAB { get; set; }

        public float? HighBC { get; set; }

        public float? HighCA { get; set; }

        /// <summary>
        /// 低压ab
        /// </summary>
        public float? Lowab { get; set; }

        public float? Lowbc { get; set; }

        public float? Lowca { get; set; }

        /// <summary>
        /// 变比A
        /// </summary>
        public float? TurnsRatioA { get; set; }

        public float? TurnsRatioB { get; set; }

        public float? TurnsRatioC { get; set; }

        /// <summary>
        /// 误差A
        /// </summary>
        public float? DeviationA { get; set; }

        public float? DeviationB { get; set; }

        public float? DeviationC { get; set; }

        /// <summary>
        /// 角度AB
        /// </summary>
        public float? AngleAb { get; set; }

        public float? AngleBc { get; set; }

        public float? AngleCa { get; set; }

        /// <summary>
        /// 试验结果
        /// </summary>
        public ExperimentResult? Result { get; set; }

        /// <summary>
        /// 试验结果Text
        /// </summary>
        public string ResultText => Result.HasValue ? Result.GetDescription() : "";
    }

    /// <summary>
    /// 变比试验分页查询
    /// </summary>
    public class TransformationRatioPageInput : PageInputBase
    {
        /// <summary>
        /// 试验任务ID
        /// </summary>
        public long? ExperimentTaskId { get; set; }

        /// <summary>
        /// 任务编号
        /// </summary>
        public string ExperimentTaskCode { get; set; }

        /// <summary>
        /// 设备编号
        /// </summary>
        public string EquipmentCode { get; set; }

        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }

    }
}
